package net.cyndeline.scalarlib.rldungeon.dgs.strategy.pointlessArea.help

import net.cyndeline.scalarlib.rldungeon.dgs.graph.{Room, DGSFunctionality}
import scalax.collection.GraphEdge.UnDiEdge
import net.cyndeline.scalarlib.rldungeon.dgs.{ActivatorResponderAmountResult, ActivatorResponderAmountEstimator}
import scalax.collection.immutable.Graph

/**
 * Framework-supplied estimator that allows the pointless area algorithm to add as many activators and responders
 * as needed, by setting the amount equal to the number of rooms + corridors.
 *
 * @constructor Create a new default estimator.
 */
class DefaultActivatorResponderEstimator[VType <: Room[VType], EType[X] <: UnDiEdge[X] with DGSFunctionality[X, EType]]
  extends ActivatorResponderAmountEstimator[VType, EType] {

  def computeResponderAmount(graph: Graph[VType, EType]): ActivatorResponderAmountResult = {
    val amount = graph.nodes.size + graph.edges.size
    ActivatorResponderAmountResult(amount, amount + 1, amount, amount + 1)
  }
}
